home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
6
/
cl0588.zip
/
STACK.C
< prev
next >
Wrap
Text File
|
1987-01-03
|
520b
|
38 lines
/* .subt | stack routines for the desktop calculator */
#define MAXVAL 100
int sp = 0;
double val[MAXVAL];
double push(f)
double f;
{
if (sp < MAXVAL)
return(val[sp++] = f);
else {
printf("error: stack full\n");
clear();
return(0.0);
}
}
double pop()
{
if (sp > 0)
return(val[--sp]);
else {
printf("error: stack empty\n");
clear();
return(0.0);
}
}
clear()
{
sp = 0;
}
/* .subt < end of file, stack.c */